package {
	import net.flashpunk.World;
	import flash.utils.ByteArray;
	import net.flashpunk.FP

	public class MyWorld extends World {
		[Embed(source = "assets/NewLevel.oel", mimeType = "application/octet-stream")]
		private const OUTDOORS_MAP_01 : Class;
		public var ground : Ground;

		public function MyWorld() {
			FP.screen.color = 0x00FFF0;
			loadMap();
			add(new Player(50, 50));
			add(new Enemy(400, 100));
			add(new Rock(200, 50));
		}

		public function loadMap() : void {
			// Obtain an XML instance
			var bytes : ByteArray = new OUTDOORS_MAP_01 as ByteArray;
			var xml : XML = new XML(bytes.readUTFBytes(bytes.length));

			// Build the tilemap
			ground = new Ground(xml);
			add(ground);

		}
	}
}
